<?php
class ErrorController 
    extends Zend_Controller_Action
{

    protected $_devEnvs = array (
    	'development'
    );
    
    public function errorAction()
    {
        $errors = $this->_getParam('error_handler');
        
        switch ($errors->type) { 
            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
        
                // 404 error -- controller or action not found
                $this->getResponse()->setHttpResponseCode(404);
                $this->view->message = $this->view->translate('pageNotFound');
                break;
            default:
                // application error 
                $this->getResponse()->setHttpResponseCode(500);
                $this->view->message = '';
                
                
                break;
        }
        
		if ( in_array(APPLICATION_ENV, $this->_devEnvs) || $this->getRequest()->getClientIp() == '186.18.88.130'){
            $this->view->exception = $errors->exception;
            $this->view->request   = $errors->request;
		}
    }

    public function notFoundAction()
    {
    	$this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
		$this->getResponse()->setHeader('Status','404 File not found');
    }
    
}

